/*
 * brief
 */
#ifndef __SD2059_H
#define __SD2059_H

#ifdef __cplusplus
 extern "C" {
#endif /* __cplusplus */


#include "stdint.h"


#define DEV_RD_ADDR (0x65)
#define DEV_WR_ADDR (0x64)

#define CTR1_ADDR   (0x0F)
#define CTR2_ADDR   (0x10)
#define CTR3_ADDR   (0x11)
#define RAM0_ADDR   (0x14)

#define CTR1_BIT_RTCF    (0x01)
#define CTR2_BIT_WRTC1   (0x80)
#define CTR1_BIT_WRTC2   (0x04)
#define CTR1_BIT_WRTC3   (0x80)

typedef union 
{
    struct 
    {
        uint8_t second;
        uint8_t minute;
		
		
        uint8_t hour  : 6;
		uint8_t null  : 1;
		uint8_t base  : 1;
		
		
        uint8_t week;
        uint8_t day;
        uint8_t month;
        uint8_t year;
        uint8_t reserve;
		
    } type;
	
    uint8_t data[8];
	
}STR_SD2059_DATA;


extern STR_SD2059_DATA RTC_realtime;



extern void sd2059_init(void);
extern void RTC_realtime_get(void);
extern void RTC_realtime_set(uint8_t *time);





#ifdef __cplusplus
}
#endif /* __cpluplus */

#endif 

